﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IUiCommand.cs" company="">
//   
// </copyright>
// <summary>
//   Defines an interface to a command that controls the appearance and behavior of a UI command representation (e.g. menu, tool-button).
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace FormsUtilities
{
    using System.Collections.Generic;
    using System.Windows.Forms;

    /// <summary>
    /// Defines an interface to a command that controls the appearance and behavior of a UI command representation (e.g. menu, tool-button).
    /// An <see cref="IUiCommand"/> interface maintains items like menus and tool-buttons, and sub <see cref="IUiCommand"/> commands.
    /// </summary>
    public interface IUiCommand
    {
        /// <summary>
        /// Gets the enumeration of UI items that this command is referring to, recursively.
        /// </summary>
        IEnumerable<ToolStripItem> Items { get; }

        /// <summary>
        /// Gets the enumeration of sub UI commands.
        /// </summary>
        IEnumerable<IUiCommand> SubCommands { get; }

        /// <summary>
        /// Gets or sets a value indicating whether the command is enabled.
        /// </summary>
        bool Enabled { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the command is visible.
        /// </summary>
        bool Visible { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the command is checked.
        /// </summary>
        bool Checked { get; set; }

        /// <summary>
        /// Add another UI to the command.
        /// </summary>
        /// <param name="newItem">The UI tool-item to add.</param>
        void RegisterUiItem(ToolStripItem newItem);

        /// <summary>
        /// Add another UI command as a sub-command to this one.
        /// </summary>
        /// <param name="subUiCommand"></param>
        void RegisterSubUiCommand(IUiCommand subUiCommand);
    }
}
